// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Elastic.Clients.Elasticsearch.Serverless.Cluster;

public partial class ClusterNamespacedClient : NamespacedClientProxy
{
	/// <summary>
	/// <para>
	/// Initializes a new instance of the <see cref="ClusterNamespacedClient"/> class for mocking.
	/// </para>
	/// </summary>
	protected ClusterNamespacedClient() : base()
	{
	}

	internal ClusterNamespacedClient(ElasticsearchClient client) : base(client)
	{
	}

	/// <summary>
	/// <para>
	/// Provides explanations for shard allocations in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-allocation-explain.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<AllocationExplainResponse> AllocationExplainAsync(AllocationExplainRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<AllocationExplainRequest, AllocationExplainResponse, AllocationExplainRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Provides explanations for shard allocations in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-allocation-explain.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<AllocationExplainResponse> AllocationExplainAsync(AllocationExplainRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<AllocationExplainRequestDescriptor, AllocationExplainResponse, AllocationExplainRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Provides explanations for shard allocations in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-allocation-explain.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<AllocationExplainResponse> AllocationExplainAsync(CancellationToken cancellationToken = default)
	{
		var descriptor = new AllocationExplainRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequestAsync<AllocationExplainRequestDescriptor, AllocationExplainResponse, AllocationExplainRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Provides explanations for shard allocations in the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-allocation-explain.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<AllocationExplainResponse> AllocationExplainAsync(Action<AllocationExplainRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new AllocationExplainRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<AllocationExplainRequestDescriptor, AllocationExplainResponse, AllocationExplainRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Delete component templates.
	/// Deletes component templates.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<DeleteComponentTemplateResponse> DeleteComponentTemplateAsync(DeleteComponentTemplateRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<DeleteComponentTemplateRequest, DeleteComponentTemplateResponse, DeleteComponentTemplateRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Delete component templates.
	/// Deletes component templates.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<DeleteComponentTemplateResponse> DeleteComponentTemplateAsync(DeleteComponentTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<DeleteComponentTemplateRequestDescriptor, DeleteComponentTemplateResponse, DeleteComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Delete component templates.
	/// Deletes component templates.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<DeleteComponentTemplateResponse> DeleteComponentTemplateAsync(Elastic.Clients.Elasticsearch.Serverless.Names name, CancellationToken cancellationToken = default)
	{
		var descriptor = new DeleteComponentTemplateRequestDescriptor(name);
		descriptor.BeforeRequest();
		return DoRequestAsync<DeleteComponentTemplateRequestDescriptor, DeleteComponentTemplateResponse, DeleteComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Delete component templates.
	/// Deletes component templates.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<DeleteComponentTemplateResponse> DeleteComponentTemplateAsync(Elastic.Clients.Elasticsearch.Serverless.Names name, Action<DeleteComponentTemplateRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new DeleteComponentTemplateRequestDescriptor(name);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<DeleteComponentTemplateRequestDescriptor, DeleteComponentTemplateResponse, DeleteComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Check component templates.
	/// Returns information about whether a particular component template exists.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ExistsComponentTemplateResponse> ExistsComponentTemplateAsync(ExistsComponentTemplateRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<ExistsComponentTemplateRequest, ExistsComponentTemplateResponse, ExistsComponentTemplateRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Check component templates.
	/// Returns information about whether a particular component template exists.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ExistsComponentTemplateResponse> ExistsComponentTemplateAsync(ExistsComponentTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<ExistsComponentTemplateRequestDescriptor, ExistsComponentTemplateResponse, ExistsComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Check component templates.
	/// Returns information about whether a particular component template exists.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ExistsComponentTemplateResponse> ExistsComponentTemplateAsync(Elastic.Clients.Elasticsearch.Serverless.Names name, CancellationToken cancellationToken = default)
	{
		var descriptor = new ExistsComponentTemplateRequestDescriptor(name);
		descriptor.BeforeRequest();
		return DoRequestAsync<ExistsComponentTemplateRequestDescriptor, ExistsComponentTemplateResponse, ExistsComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Check component templates.
	/// Returns information about whether a particular component template exists.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ExistsComponentTemplateResponse> ExistsComponentTemplateAsync(Elastic.Clients.Elasticsearch.Serverless.Names name, Action<ExistsComponentTemplateRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new ExistsComponentTemplateRequestDescriptor(name);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<ExistsComponentTemplateRequestDescriptor, ExistsComponentTemplateResponse, ExistsComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get component templates.
	/// Retrieves information about component templates.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetComponentTemplateResponse> GetComponentTemplateAsync(GetComponentTemplateRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<GetComponentTemplateRequest, GetComponentTemplateResponse, GetComponentTemplateRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get component templates.
	/// Retrieves information about component templates.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetComponentTemplateResponse> GetComponentTemplateAsync(GetComponentTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<GetComponentTemplateRequestDescriptor, GetComponentTemplateResponse, GetComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get component templates.
	/// Retrieves information about component templates.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetComponentTemplateResponse> GetComponentTemplateAsync(Elastic.Clients.Elasticsearch.Serverless.Name? name, CancellationToken cancellationToken = default)
	{
		var descriptor = new GetComponentTemplateRequestDescriptor(name);
		descriptor.BeforeRequest();
		return DoRequestAsync<GetComponentTemplateRequestDescriptor, GetComponentTemplateResponse, GetComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get component templates.
	/// Retrieves information about component templates.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetComponentTemplateResponse> GetComponentTemplateAsync(Elastic.Clients.Elasticsearch.Serverless.Name? name, Action<GetComponentTemplateRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new GetComponentTemplateRequestDescriptor(name);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<GetComponentTemplateRequestDescriptor, GetComponentTemplateResponse, GetComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get component templates.
	/// Retrieves information about component templates.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetComponentTemplateResponse> GetComponentTemplateAsync(CancellationToken cancellationToken = default)
	{
		var descriptor = new GetComponentTemplateRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequestAsync<GetComponentTemplateRequestDescriptor, GetComponentTemplateResponse, GetComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get component templates.
	/// Retrieves information about component templates.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetComponentTemplateResponse> GetComponentTemplateAsync(Action<GetComponentTemplateRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new GetComponentTemplateRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<GetComponentTemplateRequestDescriptor, GetComponentTemplateResponse, GetComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster-wide settings.
	/// By default, it returns only settings that have been explicitly defined.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-get-settings.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetClusterSettingsResponse> GetSettingsAsync(GetClusterSettingsRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<GetClusterSettingsRequest, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster-wide settings.
	/// By default, it returns only settings that have been explicitly defined.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-get-settings.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetClusterSettingsResponse> GetSettingsAsync(GetClusterSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<GetClusterSettingsRequestDescriptor, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster-wide settings.
	/// By default, it returns only settings that have been explicitly defined.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-get-settings.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetClusterSettingsResponse> GetSettingsAsync(CancellationToken cancellationToken = default)
	{
		var descriptor = new GetClusterSettingsRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequestAsync<GetClusterSettingsRequestDescriptor, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster-wide settings.
	/// By default, it returns only settings that have been explicitly defined.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-get-settings.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<GetClusterSettingsResponse> GetSettingsAsync(Action<GetClusterSettingsRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new GetClusterSettingsRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<GetClusterSettingsRequestDescriptor, GetClusterSettingsResponse, GetClusterSettingsRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync(HealthRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<HealthRequest, HealthResponse, HealthRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync<TDocument>(HealthRequestDescriptor<TDocument> descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor<TDocument>, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync<TDocument>(Elastic.Clients.Elasticsearch.Serverless.Indices? indices, CancellationToken cancellationToken = default)
	{
		var descriptor = new HealthRequestDescriptor<TDocument>(indices);
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor<TDocument>, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync<TDocument>(Elastic.Clients.Elasticsearch.Serverless.Indices? indices, Action<HealthRequestDescriptor<TDocument>> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new HealthRequestDescriptor<TDocument>(indices);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor<TDocument>, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync<TDocument>(CancellationToken cancellationToken = default)
	{
		var descriptor = new HealthRequestDescriptor<TDocument>();
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor<TDocument>, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync<TDocument>(Action<HealthRequestDescriptor<TDocument>> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new HealthRequestDescriptor<TDocument>();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor<TDocument>, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync(HealthRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync(Elastic.Clients.Elasticsearch.Serverless.Indices? indices, CancellationToken cancellationToken = default)
	{
		var descriptor = new HealthRequestDescriptor(indices);
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync(Elastic.Clients.Elasticsearch.Serverless.Indices? indices, Action<HealthRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new HealthRequestDescriptor(indices);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync(CancellationToken cancellationToken = default)
	{
		var descriptor = new HealthRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// The cluster health API returns a simple status on the health of the cluster. You can also use the API to get the health status of only specified data streams and indices. For data streams, the API retrieves the health status of the stream’s backing indices.
	/// The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-health.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<HealthResponse> HealthAsync(Action<HealthRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new HealthRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<HealthRequestDescriptor, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get cluster info.
	/// Returns basic information about the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-info.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterInfoResponse> InfoAsync(ClusterInfoRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<ClusterInfoRequest, ClusterInfoResponse, ClusterInfoRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get cluster info.
	/// Returns basic information about the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-info.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterInfoResponse> InfoAsync(ClusterInfoRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<ClusterInfoRequestDescriptor, ClusterInfoResponse, ClusterInfoRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get cluster info.
	/// Returns basic information about the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-info.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterInfoResponse> InfoAsync(IReadOnlyCollection<Elastic.Clients.Elasticsearch.Serverless.ClusterInfoTarget> target, CancellationToken cancellationToken = default)
	{
		var descriptor = new ClusterInfoRequestDescriptor(target);
		descriptor.BeforeRequest();
		return DoRequestAsync<ClusterInfoRequestDescriptor, ClusterInfoResponse, ClusterInfoRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Get cluster info.
	/// Returns basic information about the cluster.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-info.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterInfoResponse> InfoAsync(IReadOnlyCollection<Elastic.Clients.Elasticsearch.Serverless.ClusterInfoTarget> target, Action<ClusterInfoRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new ClusterInfoRequestDescriptor(target);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<ClusterInfoRequestDescriptor, ClusterInfoResponse, ClusterInfoRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet been executed.
	/// NOTE: This API returns a list of any pending updates to the cluster state.
	/// These are distinct from the tasks reported by the Task Management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests.
	/// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-pending.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PendingTasksResponse> PendingTasksAsync(PendingTasksRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<PendingTasksRequest, PendingTasksResponse, PendingTasksRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet been executed.
	/// NOTE: This API returns a list of any pending updates to the cluster state.
	/// These are distinct from the tasks reported by the Task Management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests.
	/// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-pending.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PendingTasksResponse> PendingTasksAsync(PendingTasksRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<PendingTasksRequestDescriptor, PendingTasksResponse, PendingTasksRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet been executed.
	/// NOTE: This API returns a list of any pending updates to the cluster state.
	/// These are distinct from the tasks reported by the Task Management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests.
	/// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-pending.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PendingTasksResponse> PendingTasksAsync(CancellationToken cancellationToken = default)
	{
		var descriptor = new PendingTasksRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequestAsync<PendingTasksRequestDescriptor, PendingTasksResponse, PendingTasksRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet been executed.
	/// NOTE: This API returns a list of any pending updates to the cluster state.
	/// These are distinct from the tasks reported by the Task Management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests.
	/// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-pending.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PendingTasksResponse> PendingTasksAsync(Action<PendingTasksRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new PendingTasksRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<PendingTasksRequestDescriptor, PendingTasksResponse, PendingTasksRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Create or update a component template.
	/// Creates or updates a component template.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para>
	/// An index template can be composed of multiple component templates.
	/// To use a component template, specify it in an index template’s <c>composed_of</c> list.
	/// Component templates are only applied to new data streams and indices as part of a matching index template.
	/// </para>
	/// <para>
	/// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.
	/// </para>
	/// <para>
	/// Component templates are only used during index creation.
	/// For data streams, this includes data stream creation and the creation of a stream’s backing indices.
	/// Changes to component templates do not affect existing indices, including a stream’s backing indices.
	/// </para>
	/// <para>
	/// You can use C-style <c>/* *\/</c> block comments in component templates.
	/// You can include comments anywhere in the request body except before the opening curly bracket.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PutComponentTemplateResponse> PutComponentTemplateAsync(PutComponentTemplateRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<PutComponentTemplateRequest, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Create or update a component template.
	/// Creates or updates a component template.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para>
	/// An index template can be composed of multiple component templates.
	/// To use a component template, specify it in an index template’s <c>composed_of</c> list.
	/// Component templates are only applied to new data streams and indices as part of a matching index template.
	/// </para>
	/// <para>
	/// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.
	/// </para>
	/// <para>
	/// Component templates are only used during index creation.
	/// For data streams, this includes data stream creation and the creation of a stream’s backing indices.
	/// Changes to component templates do not affect existing indices, including a stream’s backing indices.
	/// </para>
	/// <para>
	/// You can use C-style <c>/* *\/</c> block comments in component templates.
	/// You can include comments anywhere in the request body except before the opening curly bracket.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PutComponentTemplateResponse> PutComponentTemplateAsync<TDocument>(PutComponentTemplateRequestDescriptor<TDocument> descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<PutComponentTemplateRequestDescriptor<TDocument>, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Create or update a component template.
	/// Creates or updates a component template.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para>
	/// An index template can be composed of multiple component templates.
	/// To use a component template, specify it in an index template’s <c>composed_of</c> list.
	/// Component templates are only applied to new data streams and indices as part of a matching index template.
	/// </para>
	/// <para>
	/// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.
	/// </para>
	/// <para>
	/// Component templates are only used during index creation.
	/// For data streams, this includes data stream creation and the creation of a stream’s backing indices.
	/// Changes to component templates do not affect existing indices, including a stream’s backing indices.
	/// </para>
	/// <para>
	/// You can use C-style <c>/* *\/</c> block comments in component templates.
	/// You can include comments anywhere in the request body except before the opening curly bracket.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PutComponentTemplateResponse> PutComponentTemplateAsync<TDocument>(Elastic.Clients.Elasticsearch.Serverless.Name name, CancellationToken cancellationToken = default)
	{
		var descriptor = new PutComponentTemplateRequestDescriptor<TDocument>(name);
		descriptor.BeforeRequest();
		return DoRequestAsync<PutComponentTemplateRequestDescriptor<TDocument>, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Create or update a component template.
	/// Creates or updates a component template.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para>
	/// An index template can be composed of multiple component templates.
	/// To use a component template, specify it in an index template’s <c>composed_of</c> list.
	/// Component templates are only applied to new data streams and indices as part of a matching index template.
	/// </para>
	/// <para>
	/// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.
	/// </para>
	/// <para>
	/// Component templates are only used during index creation.
	/// For data streams, this includes data stream creation and the creation of a stream’s backing indices.
	/// Changes to component templates do not affect existing indices, including a stream’s backing indices.
	/// </para>
	/// <para>
	/// You can use C-style <c>/* *\/</c> block comments in component templates.
	/// You can include comments anywhere in the request body except before the opening curly bracket.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PutComponentTemplateResponse> PutComponentTemplateAsync<TDocument>(Elastic.Clients.Elasticsearch.Serverless.Name name, Action<PutComponentTemplateRequestDescriptor<TDocument>> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new PutComponentTemplateRequestDescriptor<TDocument>(name);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<PutComponentTemplateRequestDescriptor<TDocument>, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Create or update a component template.
	/// Creates or updates a component template.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para>
	/// An index template can be composed of multiple component templates.
	/// To use a component template, specify it in an index template’s <c>composed_of</c> list.
	/// Component templates are only applied to new data streams and indices as part of a matching index template.
	/// </para>
	/// <para>
	/// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.
	/// </para>
	/// <para>
	/// Component templates are only used during index creation.
	/// For data streams, this includes data stream creation and the creation of a stream’s backing indices.
	/// Changes to component templates do not affect existing indices, including a stream’s backing indices.
	/// </para>
	/// <para>
	/// You can use C-style <c>/* *\/</c> block comments in component templates.
	/// You can include comments anywhere in the request body except before the opening curly bracket.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PutComponentTemplateResponse> PutComponentTemplateAsync(PutComponentTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<PutComponentTemplateRequestDescriptor, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Create or update a component template.
	/// Creates or updates a component template.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para>
	/// An index template can be composed of multiple component templates.
	/// To use a component template, specify it in an index template’s <c>composed_of</c> list.
	/// Component templates are only applied to new data streams and indices as part of a matching index template.
	/// </para>
	/// <para>
	/// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.
	/// </para>
	/// <para>
	/// Component templates are only used during index creation.
	/// For data streams, this includes data stream creation and the creation of a stream’s backing indices.
	/// Changes to component templates do not affect existing indices, including a stream’s backing indices.
	/// </para>
	/// <para>
	/// You can use C-style <c>/* *\/</c> block comments in component templates.
	/// You can include comments anywhere in the request body except before the opening curly bracket.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PutComponentTemplateResponse> PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, CancellationToken cancellationToken = default)
	{
		var descriptor = new PutComponentTemplateRequestDescriptor(name);
		descriptor.BeforeRequest();
		return DoRequestAsync<PutComponentTemplateRequestDescriptor, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Create or update a component template.
	/// Creates or updates a component template.
	/// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
	/// </para>
	/// <para>
	/// An index template can be composed of multiple component templates.
	/// To use a component template, specify it in an index template’s <c>composed_of</c> list.
	/// Component templates are only applied to new data streams and indices as part of a matching index template.
	/// </para>
	/// <para>
	/// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.
	/// </para>
	/// <para>
	/// Component templates are only used during index creation.
	/// For data streams, this includes data stream creation and the creation of a stream’s backing indices.
	/// Changes to component templates do not affect existing indices, including a stream’s backing indices.
	/// </para>
	/// <para>
	/// You can use C-style <c>/* *\/</c> block comments in component templates.
	/// You can include comments anywhere in the request body except before the opening curly bracket.
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/indices-component-template.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<PutComponentTemplateResponse> PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, Action<PutComponentTemplateRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new PutComponentTemplateRequestDescriptor(name);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<PutComponentTemplateRequestDescriptor, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster statistics.
	/// It returns basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-stats.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterStatsResponse> StatsAsync(ClusterStatsRequest request, CancellationToken cancellationToken = default)
	{
		request.BeforeRequest();
		return DoRequestAsync<ClusterStatsRequest, ClusterStatsResponse, ClusterStatsRequestParameters>(request, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster statistics.
	/// It returns basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-stats.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterStatsResponse> StatsAsync(ClusterStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default)
	{
		descriptor.BeforeRequest();
		return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster statistics.
	/// It returns basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-stats.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterStatsResponse> StatsAsync(Elastic.Clients.Elasticsearch.Serverless.NodeIds? nodeId, CancellationToken cancellationToken = default)
	{
		var descriptor = new ClusterStatsRequestDescriptor(nodeId);
		descriptor.BeforeRequest();
		return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster statistics.
	/// It returns basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-stats.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterStatsResponse> StatsAsync(Elastic.Clients.Elasticsearch.Serverless.NodeIds? nodeId, Action<ClusterStatsRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new ClusterStatsRequestDescriptor(nodeId);
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster statistics.
	/// It returns basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-stats.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterStatsResponse> StatsAsync(CancellationToken cancellationToken = default)
	{
		var descriptor = new ClusterStatsRequestDescriptor();
		descriptor.BeforeRequest();
		return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor, cancellationToken);
	}

	/// <summary>
	/// <para>
	/// Returns cluster statistics.
	/// It returns basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).
	/// </para>
	/// <para><see href="https://www.elastic.co/guide/en/elasticsearch/reference/8.15/cluster-stats.html">Learn more about this API in the Elasticsearch documentation.</see></para>
	/// </summary>
	public virtual Task<ClusterStatsResponse> StatsAsync(Action<ClusterStatsRequestDescriptor> configureRequest, CancellationToken cancellationToken = default)
	{
		var descriptor = new ClusterStatsRequestDescriptor();
		configureRequest?.Invoke(descriptor);
		descriptor.BeforeRequest();
		return DoRequestAsync<ClusterStatsRequestDescriptor, ClusterStatsResponse, ClusterStatsRequestParameters>(descriptor, cancellationToken);
	}
}